//
//  EntrustTableViewCell.m
//  RedManStock
//
//  Created by lanou3g on 15/8/1.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "EntrustTableViewCell.h"
#import "MyCoreHandle.h"
@implementation EntrustTableViewCell

- (void)awakeFromNib {
    // Initialization code
    [self.cancelButton addTarget:self action:@selector(cancelEntrust:) forControlEvents:UIControlEventTouchUpInside];
}

//通过委托的时间来删除
- (void)cancelEntrust:(UIButton *)button{
    [[MyCoreHandle shareHandle] deleteMyEntrust:self.entrust.entrustDate];
    //通过属性传值，将cell所在的tableView传了过来
    [self.tableView reloadData];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setEntrust:(MyCoreEntrust *)entrust{
    if (_entrust!=entrust) {
        _entrust=entrust;
    }
    self.stockStrLabel.text=[NSString stringWithFormat:@"%@ %@",entrust.stockName,entrust.stockCode];
    self.entrustPriceLabel.text=[NSString stringWithFormat:@"%@元",entrust.entrustPrice];
    self.volumeLabel.text=[NSString stringWithFormat:@"%@元",entrust.volume];
    self.tradePriceLabel.text=[NSString stringWithFormat:@"%@元",entrust.tradePrice];
    self.whichLabel.text=entrust.which;
    self.dateLabel.text=entrust.entrustDate;
}

@end
